import Mock from 'mockjs'

// const {data} = Mock.mock({
//     "data|6": [
//         {
//             'image': [
//                 { imgurl: 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/首页/u449.png' },
//                 { imgurl: 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/%E9%A6%96%E9%A1%B5/u383.png' },
//                 { imgurl: 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/%E9%A6%96%E9%A1%B5/u347.png' },
//                 { imgurl: 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png' },
//                 { imgurl: 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u724.png' },
//                 { imgurl: 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/%E9%A6%96%E9%A1%B5/u276.jpg' }
//               ],
//             'title': '@ctitle(5, 10)',
//             "number|60-100": 6,
//             'name': '@cname()',
//             'id': '@guid()'
//         }
//     ]
// })

// // 获取
const { data } = Mock.mock({
    'data': [
        {
            'name': '美食',
            'fTitle':
                ['美味寿司', '蒸饺', '吃个鸭梨', '美味寿司', '蒸饺', '吃个鸭梨'],
            'img':
                {
                    'img1': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img2': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img3': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img4': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img5': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img6': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                },

        },
        {
            'name': '民宿',
            'fTitle':
                ['11', '22', '33', '77', '99', '20'],
            'img':
                {
                    'img1': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img2': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img3': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img4': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                    'img5': 'https://img.axureshop.com/c2/e9/7b/c2e97b96ebac43fdaa2b01538e82639f/images/发现/u667.png',
                },

        }
    ]
})

// 美食接口
Mock.mock('/getFoodList', 'post', (config) => {
    const req = JSON.parse(config.body)
    let obj = {}
    data.forEach((item, index) => {
        console.log(item.name,req.name);
        if(item.name == req.name) {
            obj = item
        }
    })
    if(obj.name){
return obj
    }else {
return {
        code: 300,
        msg: '获取失败'
    }
    }
    
})